TankPoints 2.0 - A benchmark for tanking gear.

** About TankPoints **

TankPoints was created to help compare different pieces of tanking gear, because it was difficult to decided at a glance like whether +12 defense is better then +1 dodge.

TankPoints can be seen as how much damage you can take before damage reduction, it considers your max health, armor, defense, dodge, parry, block, block value, resilience, crushing blow chance, miss, crit reduction, talants, buffs, stance/forms, and more.

Keep in mind though, that higher TankPoints does not mean a better tank just maybe better gear, it is only a benchmark for "tanking GEAR" but not "tanking".
It can not decide for you what you should wear on what boss, but it can provide you with a wealth of information what will hopfully be useful for choosing gear.


** About TankPoints 2.0 **

TankPoints 2.0 is a complete rewrite of my original TankPoints for WoW 2.0+ using the Ace2 framework.

It has a much improved TankPoints algorithm, intergrates nicely into the character stats dropdown menu, and shows a lot more information then the original TankPoints.

2.0 introduced a new combat ratings system which made it even harder to compare gear, in order to code combat rating support for TankPoints, the exact rating to percentage formula is required which Blizzard didn't give us.
Luckly, I have suceessfully reverse engineered the rating formula for all levels and coded an addon called "Rating Buster" that converts ratings on item tooltips into percentages, you can try it out here.

Rating Buster: 
http://wow.curse-gaming.com/en/files/details/4991/rating-buster/
http://www.wowinterface.com/downloads/fileinfo.php?s=&id=5819

** TankPoints 2.0 Features **

In addition to the original formula, the Imporved TankPoints 2.0 formula now has:
- support for all combat ratings including the new resilience stat
- support for block% and block value
- support for crushing blows
- support for combat table and correctly caps off at a total of 100%
  using Hit < Crushing < Crit < Block < Parry < Dodge < Miss
- support for mob stats:
  - mob level - defaults player level +3
  - mob damage
  - mob melee crit chance
  - mob melee crit bonus
  - mob melee miss chance
  - mob spell crit chance
  - mob spell crit bonus
  - mob spell miss chance

Improved TankPoints Calculator

TankPoints User Interface(See Screeshots):
- Intergrated in to the Character stats dropdown menu
- When TankPoints is selected it displays:
  - TankPoints
  - Melee Damage Reduction
  - Block Value
  - Spell TankPoints
  - Spell Damage Reduction
- TankPoints tooltip:
  - Your stance
  - Mob Stats
    - Mob Level
    - Mob Damage (after damage reduction)
    - Mob Crit Chance
    - Mob Miss Chance
  - TankPoints per StatValue - Shows how much TankPoints you gain for each stats with equal item values, because the values below are equal in the item value formula, you can use this data to see what gives the most bang for the buck in terms of item budgets.
    - 1 Agility = 
    - 1.5 Stamina = 
    - 10 Armor = 
    - 1 Resilience = 
    - 1 Defense Rating = 
    - 1 Dodge Rating = 
    - 1 Parry Rating = 
    - 1 Block Rating = 
    - 1.54 Block Value
  - Option to hold down ALT key will show how much TankPoints you gain for each stat point
    - 1 Agility
    - 1 Stamina
    - 1 Armor
    - 1 Resilience
    - 1% Defense
    - 1% Dodge
    - 1% Parry
    - 1% Block
    - 1 Block Value
- Melee Damage Reduction tooltip:
  - Armor Damage Reduction against mob level - Useful because the default armor tooltip only shows the reduction for the same level
  - Mob Level, Player Level
  - Combat Table - Hit < Crushing < Crit < Block < Parry < Dodge < Miss
    The total of these chances must be capped at 100%, if you exceed 100% then lower priority values will be pushed off the table. 
    For example, when you press shield block (+75% block chance), hit, crush and crit will all be pushed off and will be 0, your real block chance will also be capped at (100% - Parry% - Dodge% - Miss%)
- Block Value tooltip - Block Value should have been included in the default UI, but they didn't so I coded my own function that does it, strength, items, talents(warrior, paladin, shaman) are all considered in the algorithm.
  - Mob Damage before Damage Reduction (armor and stance effects)
  - Mob Damage after Damage Reduction
  - Blocked percentage = Block Value / Mob Damage after DR
  - Block Chance
  - Equivalent Block Mitigation = Block Chance * Blocked percentage
    This can be seen equal with the same amount of dodge or parry.
- Spell TankPoints Tooltip - Shows your strongest school by default
  - Your stance
  - TankPoints at the following Melee/Spell Damage Ratio
    - 25% Melee Damage + 75% <school> damage
    - 50% Melee Damage + 50% <school> damage
    - 75% Melee Damage + 25% <school> damage
  - Can manually cycle through all schools by left clicking the stat
  - Reset back to showing the strongest school by right click the stat
- Spell Damage Reduction - Shows your strongest school by default
  - Shows damage reductions for all schools
  - Same click functions as the Spell TankPoints Tooltip

Support for various class specific talants and buffs:
- Warrior: Improved Defensive Stance
           Reduces all spell damage taken while in Defensive Stance by 2%/4%/6%.
- Warrior: Shield Mastery
           Increases the amount of damage absorbed by your shield by 10%/20%/30%.
- Warrior: Shield Wall - Buff
           Reduces the Physical and magical damage taken by the caster by 75% for 10 sec.
- Warrior: Death Wish - Buff
           When activated, increases your physical damage by 20% and makes you immune to Fear effects, but increases all damage taken by 5%. Lasts 30 sec.
- Warrior: Recklessness - Buff
           The warrior will cause critical hits with most attacks and will be immune to Fear effects for the next 15 sec, but all damage taken is increased by 20%.
- Warrior: Toughness
           Increases your armor value from items by 2%/4%/6%/8%/10%.
- Warrior: Vitality
           Increases your total Stamina by 1%/2%/3%/4%/5% and your total Strength by 2%/4%/6%/8%/10%.
- Druid: Survival of the Fittest
         Increases all attributes by 1%/2%/3% and reduces the chance you'll be critically hit by melee attacks by 1%/2%/3%.
- Druid: Natural Perfection
         Your critical strike chance with all spells is increased by 3% and melee and ranged critical strikes against you cause 4%/7%/10% less damage.
- Druid: Thick Hide
         Increases your Armor contribution from items by 4%/7%/10%.
- Druid: Balance of Power
         Increases your chance to hit with all spells and reduces the chance you'll be hit by spells by 2%/4%.
- Druid: Heart of the Wild
         Increases your Intellect by 4%/8%/12%/16%/20%. In addition, while in Bear or Dire Bear Form your Stamina is increased by 4%/8%/12%/16%/20% and while in Cat Form your Strength is increased by 4%/8%/12%/16%/20%.
- Paladin: Shield Specialization
           Increases the amount of damage absorbed by your shield by 10%/20%/30%.
- Paladin: Divine Purpose
           Melee and ranged critical strikes against you cause 4%/7%/10% less damage.
- Paladin: Blessed Life
           All attacks against you have a 4%/7%/10% chance to cause half damage.
- Paladin: Ardent Defender
           When you have less than 20% health, all damage taken is reduced by 10%/20%/30%/40%/50%.
- Paladin: Spell Warding
           All spell damage taken is reduced by 2%/4%.
- Paladin: Improved Righteous Fury
           While Righteous Fury is active, all damage taken is reduced by 2%/4%/6% and increases the amount of threat generated by your Righteous Fury spell by 16%/33%/50%.
- Paladin: Divine Strength 
           Increases your total Strength by 2%/4%/6%/8%/10%.
- Paladin: Toughness
           Increases your armor value from items by 2%/4%/6%/8%/10%.
- Shaman: Shield Specialization
          Increases your chance to block attacks with a shield by 1%/2%/3%/4%/5% and increases the amount blocked by 5%/10%/15%/20%/25%.
- Shaman: Elemental Shields
          Reduces the chance you will be critically hit by melee and ranged attacks by 2%/4%/6%.
- Shaman: Elemental Warding
          Reduces damage taken from Fire, Frost and Nature effects by 4%/7%/10%.
- Shaman: Toughness
          Increases your armor value from items by 2%/4%/6%/8%/10%.
- Rogue: Sleight of Hand
         Reduces the chance you are critically hit by melee and ranged attacks by 2% and increases the threat reduction of your Feint ability by 20%.
- Rogue: Heightened Senses
         Increases your Stealth detection and reduces the chance you are hit by spells and ranged attacks by 2%/4%.
- Rogue: Deadened Nerves
         Decreases all physical damage taken by 1%/2%/3%/4%/5%
- Rogue: Vitality
         Increases your total Stamina by 2%/4% and your total Agility by 1%/2%.
- Rogue: Sinister Calling
         Increases your total Agility by 3%/6%/9%/12%/15%.
- Rogue: Cloak of Shadows - Buff
         Instantly removes all existing harmful spell effects and increases your chance to resist all spells by 90% for 5 sec. Does not remove effects that prevent you from using Cloak of Shadows.
- Hunter: Survival Instincts
          Reduces all damage taken by 2%/4%.
- Hunter: Thick Hide
          Increases the armor rating of your pets by 20% and your armor contribution from items by 4%/7%/10%.
- Hunter: Combat Experience
          Increases your total Agility by 1%/2% and your total Intellect by 3%/6%.
- Hunter: Lightning Reflexes
          Increases your Agility by 3%/6%/9%/12%/15%.
- Priest: Shadow Resilience
          Reduces the chance you'll be critically hit by all spells by 2%/4%.
- Priest: Spell Warding
          Reduces all spell damage taken by 2%/4%/6%/8%/10%.
- Hunter: Survivalist
          Increases total health by 2%/4%/6%/8%/10%.
- Hunter: Endurance Training
          Increases the Health of your pet by 2%/4%/6%/8%/10% and your total health by 1%/2%/3%/4%/5%.
- Priest: Pain Suppression - Buff
          Reduces all damage taken by 60% for 8 sec.
- Priest: Enlightenment
          Increases your total Stamina, Intellect and Spirit by 1%/2%/3%/4%/5%.
- Warlock: Demonic Resilience
           Reduces the chance you'll be critically hit by melee and spells by 1%/2%/3% and reduces all damage your summoned demon takes by 15%.
- Warlock: Master Demonologist
           Voidwalker - Reduces physical damage taken by 2%/4%/6%/8%/10%.
- Warlock: Soul Link - Buff
           When active, 20% of all damage taken by the caster is taken by your Imp, Voidwalker, Succubus, Felhunter or Felguard demon instead. Lasts as long as the demon is active.
- Warlock: Demonic Embrace
           Increases your total Stamina by 3%/6%/9%/12%/15% but reduces your total Spirit by 1%/2%/3%/4%/5%.
- Warlock: Fel Stamina
           Increases the Stamina of your Imp, Voidwalker, Succubus, Felhunter and Felguard by 5%/10%/15% and increases your maximum health by 1%/2%/3%.
- Mage: Arctic Winds
        Reduces the chance melee and ranged attacks will hit you by 1%/2%/3%/4%/5%.
- Mage: Prismatic Cloak
        Reduces all damage taken by 2%/4%.
- Mage: Playing with Fire
        Increases all spell damage caused by 1%/2%/3% and all spell damage taken by 1%/2%/3%.
- Mage: Frozen Core
        Reduces the damage taken by Frost and Fire effects by 2%/4%/6%.


** Slash Commands **

Use: /tp or /tankpoints

/tp - Show help
/tp calc - Toggle calculator
/tp mob - Show mob stats help 
/tp mob level (-20 - +20) - Sets the level difference between the mob and you
/tp mob damage (0 - 99999) - Sets mob's damage before damage reduction
/tp mob default - Restores default mob stats
/tp mob advanced - Show advanced mob stats help
/tp mob advanced crit (0 - 100) - Sets mob's melee crit chance
/tp mob advanced critbonus - Sets mob's melee crit bonus
/tp mob advanced miss (0 - 100) - Sets mob's melee miss chance
/tp mob advanced spellcrit (0 - 100) - Sets mob's spell crit chance
/tp mob advanced spellcritbonus - Sets mob's spell crit bonus
/tp mob advanced spellmiss (0 - 100) - Sets mob's spell miss chance


** TankPoints Formulas **

=== Armor Reduction ===
levelModifier = attackerLevel
if ( levelModifier > 59 ) then
  levelModifier = levelModifier + (4.5 * (levelModifier - 59))
end
armorReductionTemp = armor / ((85 * levelModifier) + 400)
armorReduction = armorReductionTemp / (armorReductionTemp + 1)
if armorReduction > 0.75 then
  armorReduction = 0.75
end
if armorReduction < 0 then
  armorReduction = 0
end

=== Defense Effect ===
- defenseEffect = (defense - attackerLevel * 5) * 0.04 * 0.01

=== Block Value From Strength ===
- blockValueFromStrength = (strength * 0.05) - 1

=== Block Value ===
- blockValue = floor(blockValueFromStrength) + floor((blockValueFromItems + blockValueFromShield) * blockValueMod)

=== Mob Damage (default formula) ===
- mobDamage = (levelModifier * 55) * meleeTakenMod * (1 - armorReduction)

=== Resilience Effect ===
- resilienceEffect = ReverseRating(resilience, playerLevel) * 0.01

=== Mob Crit Chance ===
- mobCritChance = max(0, 0.05 - defenseEffect - resilienceEffect)

=== Mob Crit Bonus ===
- mobCritBonus = 1

=== Mob Miss Chance ===
- mobMissChance = max(0, 0.05 + defenseEffect)

=== Mob Crush Chance (if mobLevel is +3) ===
- mobCrushChance = 0.15 + max(0, (playerLevel * 5 - defense) * 0.02)

=== Mob Crit Damage Mod ===
- mobCritDamageMod = max(0, 1 - resilienceEffect * 2)

=== Blocked Mod ===
- blockedMod = min(1, blockValue / mobDamage)

=== Mob Spell Crit Chance ===
- mobSpellCritChance = max(0, 0 - resilienceEffect)

=== Mob Spell Crit Bonus ===
- mobSpellCritBonus = 0.5

=== Mob Spell Miss Chance ===
- mobSpellMissChance = 0

=== Mob Spell Crit Damage Mod ===
- mobSpellCritDamageMod = max(0, 1 - resilienceEffect * 2)

=== Resistance Reduction ===
- schoolReduction[SCHOOL] = 0.75 * (resistance[SCHOOL] / (mobLevel * 5))

=== Melee Total Reduction ===
- totalReduction[MELEE] = 1 - ((mobCritChance * (1 + mobCritBonus) * mobCritDamageMod) + (mobCrushChance * 1.5) + (1 - mobCrushChance - mobCritChance - blockChance * blockedMod - parryChance - dodgeChance - mobMissChance)) * (1 - armorReduction) * meleeTakenMod

=== Spell Total Reduction ===
- totalReduction[SCHOOL] = 1 - ((mobSpellCritChance * (1 + mobSpellCritBonus) * mobSpellCritDamageMod) + (1 - mobSpellCritChance - mobSpellMissChance)) * (1 - schoolReduction[SCHOOL]) * spellTakenMod

=== TankPoints ===
- tankPoints = playerHealth / (1 - totalReduction)


** TODO **
- DodgeTalant support in dodgePerAgi
http://www.thottbot.com/?e=Apply%20Aura%3A%20Mod%20Dodge%20Percent
- Calculator support for Non class specific buffs: Blessing of Kings...etc


** Version History **
2.5.7
- Fixed incorrect tooltip values
- Fixed calculater rounding errors
2.5.6
- Fixed library error
2.5.5
- Added StatLogic deDE localizations by Gailly
2.5.4
- Fixed incorrect armor calculations in tooltips for Druilds
- Added Taiwan localizations by CuteMiyu
2.5.3
- Updated Korean localization by fenlis
2.5.2
- Fixed another StatLogic bug
2.5.1
- Fixed StatLogic bug
- Druid Bear Form formulas updated to 2.0.10 fixes
- Updated French localizations by Tixu
- Added Korean localization by fenlis
2.5.0
- Item tooltips will now show TankPoints (only works for English client until localized)
- Removed Compost
- Removed ReverseRating.lua
- Code cleanup and optimizations
2.4.1
- Fixed Calculator Block Value from Strength calculations
2.4.0
- May now input Armor from items and Armor from non items in the Calculator
- Really fixed Night Elf and Feral Swiftness dodge calculations
- Improved accuracy of calculator stat calculations
- Improved calculator support for Druid Forms
- Calculator support for Druid talant - Heart of the Wild, Balance of Power, 
- Calculator support for Rogue talant - Cloak of Shadows
- Calculator support for Paladin talant - Toughness
- Calculator support for Hunter talant - Survivalist, Endurance Training
- Calculator support for Warlock talant - Fel Stamina
- Calculator support for health mods
- Support for Death Wish, Recklessness
2.3.5
- Fixed Druid, Hunter and Night Elf dodge calculation bug
- Fixed Druid talant - Survival of the Fittest not being counted bug
- Fixed Paladin talant - Ardent Defender being always on bug
2.3.3
- Fixed Druid Dire Bear Form armor calculations
2.3.2
- Added support for new pally talants: Spell Warding, Improved Righteous Fury
- Updated Libs
2.3.1
- TOC 20003
- Updated Libs
2.3
- Greatly improved the Calculator algorithms
- Calculator: better support for talants that give bonus strength, agility, stamina, armor
- Calculator: better handling for Defense Rating
- Improved TP per StatValue/Stat calculations in TankPoints tooltips
2.2.3
- Fixed low level resistance calculations
- Fixed Druid Bear Form armor bonus
- Plays nice with other mods that may add to the character dropdown list
2.2.2
- Fixed Tauren health error
2.2.1
- Added German localization by AbbedieD
- Improved support for Druid armor bonuses in various forms
- Removed (%) from Defense in Caculator
- Partially updated French localizations
- Updated libs
2.2
- The improved TankPoints Calculator is now in
- Changed Soul Link formula 30% -> 20%
2.1.1
- Fixed TP per defense rating in tooltip again
- Updated French localizations by Tixu
2.1
- Support for various class specific talants and buffs
- Fixed TP per defense rating in tooltip
- PlayerHasShield() localized
- GetBlockValue() localized
- Fixed a couple slash command's option range
- Partial French localizations by Tixu
2.0.1
- Fixed ReverseRating error
- Updated Libs
- Fixed a display bug in TankPoints tooltips 
- Fixed Block Value algorithm not working with some shields
- Set Block% to zero if you don't have a shield on
2.0
- Complete rewrite for the 2.0 client using Ace2